﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}

<form id="form1">
    <div role="tabpanel" class="tab-pane fade in" style="padding-top: 20px; margin-right: 30px;" id="userRole">
        <div id="roleList"></div>
    </div>
</form>

<script>
    var keyValue = $.request("keyValue");
    var orgId = $.request("orgId");
    $(function () {
        $("#roleList").treeview({
            height: 400,
            slimscroll: false,
            showcheck: true,
            url: "/Role/GetRoleList?organizeId=" + orgId,
            param: { userId: keyValue }
        });
    });

    function AcceptClick(callBack) {
        var postData = {};
        postData["organizeId"] = orgId;
        postData["roleList"] = String($("#roleList").getCheckedNodes());
        $.submitForm({
            url: "/User/UpdateUserRole?keyValue=" + keyValue,
            param: postData,
            success: function () {
                callBack();
                $.modalClose();
            }
        })
    }
</script>